package cn.online.action;

import java.util.List;

import cn.online.model.Reply;
import cn.online.service.ReplyService;

import com.opensymphony.xwork2.ActionSupport;

public class ReplyAction extends ActionSupport {
	
	private ReplyService replyService;
	private Reply reply;
	private List<Reply> replyL;
	private Integer pid;
	private Integer rid;
	
	
	public void setRid(Integer rid) {
		this.rid = rid;
	}
	public void setPid(Integer pid) {
		this.pid = pid;
	}
	public Reply getReply() {
		return reply;
	}
	public void setReply(Reply reply) {
		this.reply = reply;
	}
	public List<Reply> getReplyL() {
		return replyL;
	}
	public void setReplyService(ReplyService replyService) {
		this.replyService = replyService;
	}
	
	public String add(){
		replyService.insert(reply, pid);
		return SUCCESS;
	}
	
	public String update(){
		replyService.updateReply(reply);
		return SUCCESS;
	}
	
	public String list(){
		if(pid==null)
			return INPUT;
		replyL=replyService.getListByProblemId(pid);
		return SUCCESS;
	}
	
	public String load(){
		if(rid==null)
			return INPUT;
		reply=replyService.get(rid);
		return SUCCESS;
	}
}
